import { createApp } from 'vue'
import App from './App.vue'

const app = createApp(App)

//自定义v-focus指令
app.directive('focus', {
    mounted(el) {
        console.log(el)
        //挂载完毕后，直接聚焦
        el.focus()
    }
})


// 自定义v-color指令
// app.directive('color', {
//     mounted(el, binding) {
//         console.log(el, binding)
//         el.style.color = binding.value
//     },
//     updated(el, binding) {
//         console.log(el, binding)
//         el.style.color = binding.value
//     }
// })

//简化后的v-color指令
app.directive('color', (el, binding, vnode, prevVnode) => {
    console.log(el)
    console.log(binding)
    console.log(vnode)
    console.log(prevVnode)
    el.style.color = binding.value
})

app.mount('#app')
